package org.freeswitch;

import org.freeswitch.swig.freeswitch;

/**
 * @author wws
 * @date 2018-10-19
 */
public class OriginateStateHandler implements StateHandler.OnHangupHandler,StateHandler.OnInitHandler,
		StateHandler.OnDestroyHandler,StateHandler.OnConsumeMediaHandler,StateHandler.OnExecuteHandler,
		StateHandler.OnRoutingHandler,StateHandler.OnSoftExecuteHandler,StateHandler.OnExchangeMediaHandler {

	private static OriginateStateHandler instance = null;

	public static final OriginateStateHandler getInstance() {
		if ( instance == null ) instance = new OriginateStateHandler();
		return instance;
	}

	private OriginateStateHandler() {
		// hide constructor
	}

	@Override
	public int onHangup(String uuid, String cause) {
		freeswitch.console_log("notice", "wws mod java test--->onHangup: " + uuid +"cause:"+cause+"\n");
		return 1; // SWITCH_STATUS_FALSE
	}

	@Override
	public int onConsumeMedia(String s) {
		freeswitch.console_log("notice", "wws mod java test--->onConsumeMedia: " + s +"\n");
		return 0;
	}

	@Override
	public int onDestroy(String s) {
		freeswitch.console_log("notice", "wws mod java test--->onDestroy: " + s +"\n");
		return 0;
	}

	@Override
	public int onExchangeMedia(String s) {
		freeswitch.console_log("notice", "wws mod java test--->onExchangeMedia: " + s +"\n");
		return 0;
	}

	@Override
	public int onExecute(String s) {
		freeswitch.console_log("notice", "wws mod java test--->onExecute: " + s +"\n");
		return 0;
	}

	/*@Override
	public int onHangup(String s, String s1) {
		freeswitch.console_log("notice", "wws mod java test--->onHangup: " + s +"\n");
		return 0;
	}*/

	@Override
	public int onInit(String s) {
		freeswitch.console_log("notice", "wws mod java test--->onInit: " + s +"\n");
		return 0;
	}

	@Override
	public int onRouting(String s) {
		freeswitch.console_log("notice", "wws mod java test--->onRouting: " + s +"\n");
		return 0;
	}

	@Override
	public int onSoftExecute(String s) {
		freeswitch.console_log("notice", "wws mod java test--->onSoftExecute: " + s +"\n");
		return 0;
	}
}